/*
 * Packet.h
 *
 *  Created on: Oct 10, 2012
 *      Author: nam20485
 */

#ifndef PACKET_H_
#define PACKET_H_

#include "Message.h"
#include "Arduino.h"
#include "Array.h"

//template<typename BYTE>
class Packet
{
public:
	typedef unsigned char BYTE;
	typedef int SIZE_T;

	Packet(Message::Type eType, BYTE* aBytes, SIZE_T usLength);
	virtual ~Packet();

	inline Message::Type getType() const	{ return m_eType; }
	inline SIZE_T getLength() const		{ return m_length; }
	inline const BYTE* getBytes() const	{ return m_aBytes.getElements(); }

	virtual unsigned int ToBytes(BYTE* aBytes = 0) const;

protected:
	const Message* 		m_pMessage;
	const Message::Type m_eType;
	const SIZE_T 		m_length;
	Array<BYTE> 		m_aBytes;
};

#endif /* PACKET_H_ */
